package com.example.yuejian23.yuejian_23.model;

import com.example.yuejian23.yuejian_23.javaBean.Result;
import com.example.yuejian23.yuejian_23.service.UserService;

import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by dong on 2017/9/27.
 */

public class UserModel {
    private Retrofit retrofit;
    public UserModel(){
        retrofit  = new Retrofit.Builder()
                .baseUrl("http://115.159.93.244/new18yuejian/api.php/")
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }

    public retrofit2.Call login(String str_user, String str_password)
    {
        UserService userService=retrofit.create(UserService.class);
        return userService.userLogin(str_user,str_password);
    }
    public retrofit2.Call reg(String str_name, String str_password,String str_username){
        UserService userService=retrofit.create(UserService.class);
        return  userService.userReg(str_name,str_password,str_username);
    }
    public retrofit2.Call<Result> saveUserInfoById(String userId, String userName, String userPhone){
        UserService userService=retrofit.create(UserService.class);
        return  userService.updateUserInfoById(userId,userName,userPhone);
    }

}
